/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.core.repository.entity;

import com.gitee.peigenlpy.actable.annotation.Column;
import com.gitee.peigenlpy.actable.annotation.Index;
import com.gitee.peigenlpy.actable.annotation.Table;
import com.gitee.peigenlpy.actable.annotation.Unique;
import com.gitee.peigenlpy.actable.constants.MySqlCharsetConstant;
import com.gitee.peigenlpy.actable.constants.MySqlEngineConstant;
import com.gitee.peigenlpy.actable.constants.MySqlTypeConstant;
import info.peigen.hotpot.business.customer.facade.enums.CustomerLevelType;
import info.peigen.hotpot.business.customer.facade.enums.CustomerRegisterMethod;
import info.peigen.hotpot.business.customer.facade.enums.CustomerSource;
import info.peigen.hotpot.business.customer.facade.enums.CustomerStatus;
import info.peigen.hotpot.component.data.repository.beetlsql.entity.AbstractCreateTimeEntity;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

import static info.peigen.hotpot.business.customer.facade.enums.CustomerLevelType.Bronze;
import static info.peigen.hotpot.business.customer.facade.enums.CustomerRegisterMethod.SELF;

/**
 * <b>(CustomerEntity)</b>
 * 客户表
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/1
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
@Table(name = "customer", comment = "客户表", charset = MySqlCharsetConstant.UTF8MB4, engine = MySqlEngineConstant.InnoDB)
@org.beetl.sql.annotation.entity.Table(name = "customer")
public class CustomerEntity extends AbstractCreateTimeEntity {
    @Column(name = "customer_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "客户Id")
    @Unique(value = "customerId", columns = "customer_id")
    @org.beetl.sql.annotation.entity.Column("customer_id")
    String                 customerId;
    @Column(name = "status", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false,
            comment = "客户状态;INIT:初始化, QUICK_REGISTER:快速注册客户, UN_ACTIVATED:注册未激活, UN_CERT:未实名, CERT_PASS:已实名, NORMAL:正常客户, FREEZE:账户被冻结, UN_SUBSCRIBE:账户被注销")
    @Index(value = "status", columns = "status")
    @org.beetl.sql.annotation.entity.Column("status")
    CustomerStatus         status;
    @Column(name = "customer_score", type = MySqlTypeConstant.BIGINT, length = 30, isNull = false, comment = "客户积分")
    @org.beetl.sql.annotation.entity.Column("customer_score")
    Long                   customerScore;
    @Column(name = "level_type", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false,
            comment = "等级;Bronze:青铜,Silver:白银,Gold:黄金,Platinum:铂金,Diamond:钻石")
    @org.beetl.sql.annotation.entity.Column("level_type")
    @Builder.Default
    CustomerLevelType      levelType              = Bronze;
    @Column(name = "mobile", type = MySqlTypeConstant.VARCHAR, length = 20, comment = "手机号")
    @Unique(value = "mobile", columns = "mobile")
    @org.beetl.sql.annotation.entity.Column("mobile")
    String                 mobile;
    @Column(name = "email", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "邮件")
    @org.beetl.sql.annotation.entity.Column("email")
    String                 email;
    @Column(name = "customer_register_method", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false,
            comment = "注册方式;SELF:主动注册, SALES:销售")
    @org.beetl.sql.annotation.entity.Column("customer_register_method")
    @Builder.Default
    CustomerRegisterMethod customerRegisterMethod = SELF;
    @Column(name = "permission", type = MySqlTypeConstant.JSON, comment = "客户权限")
    @org.beetl.sql.annotation.entity.Column("permission")
    String                 permission;
    @Column(name = "invite_code", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "邀请码")
    @org.beetl.sql.annotation.entity.Column("invite_code")
    String                 inviteCode;
    @Column(name = "proxy_id", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "代理商")
    @Index(value = "proxyId", columns = "proxy_id")
    @org.beetl.sql.annotation.entity.Column("proxy_id")
    String                 proxyId;
    @Column(name = "sales_id", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "销售Id")
    @Index(value = "salesId", columns = "sales_id")
    @org.beetl.sql.annotation.entity.Column("sales_id")
    String                 salesId;
    @Column(name = "customer_service_id", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "客服")
    @Index(value = "customerServiceId", columns = "customer_service_id")
    @org.beetl.sql.annotation.entity.Column("customer_service_id")
    String                 customerServiceId;
    @Column(name = "nickname", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "昵称")
    @org.beetl.sql.annotation.entity.Column("nickname")
    String                 nickname;
    @Column(name = "avatar", type = MySqlTypeConstant.VARCHAR, length = 500, comment = "头像")
    @org.beetl.sql.annotation.entity.Column("avatar")
    String                 avatar;
    @Column(name = "qq", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "qq")
    @org.beetl.sql.annotation.entity.Column("qq")
    String                 qq;
    @Column(name = "wechat", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "微信")
    @org.beetl.sql.annotation.entity.Column("wechat")
    String                 wechat;
    @Column(name = "address", type = MySqlTypeConstant.VARCHAR, length = 200, comment = "地址")
    @org.beetl.sql.annotation.entity.Column("address")
    String                 address;
    @Column(name = "source", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false, comment = "客户来源;INIT:初始化, B2B:B2B注册, B2C:B2C注册, EZYMONENY:EZYMONENY同步")
    @org.beetl.sql.annotation.entity.Column("source")
    CustomerSource         source;
}